﻿using System;

namespace Jink.Playground.Domain
{
    internal class SPUser : IEquatable<SPUser>
    {
        public String FirstName { get; set; }
        public String LastName { get; set; }

        public bool Equals(SPUser other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.FirstName, FirstName) && Equals(other.LastName, LastName);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(SPUser)) return false;
            return Equals((SPUser)obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return ((FirstName != null ? FirstName.GetHashCode() : 0) * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
            }
        }

        public static bool operator ==(SPUser left, SPUser right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(SPUser left, SPUser right)
        {
            return !Equals(left, right);
        }
    }
}
